﻿@model ProyectoTerminalRetiro.Clases.Respuesta
<!doctype html>
<html>
<head>
    <title>Home</title>
    <script src="//code.jquery.com/jquery-1.11.0.min.js"></script>

</head>

<body>

    <h2>Administracion de Micros de la empresa @Model.UnicaEmpresa.Nombre</h2>



    <h3>Nuevo micro empresa</h3>

    <form id="formularioAltaMicro" method="post">
        <table>
            <thead>
            </thead>
            <tbody>
                <tr>
                    <td><input type="text" value="@Model.UnicaEmpresa.id" hidden="hidden" id="idEmpresa"></td>
                    <td></td>
                </tr>

                <tr>
                    <td><span>Codigo Interno:</span></td>
                    <td>
                        <input type="text" maxlength="3" name="codigointerno" id="codigoInterno" /></td>
                </tr>
                <tr>
                    <td><span>Destino:</span></td>
                    <td>
                        
                        <select id="idDestino">
                            @foreach (var destino in Model.Destinos)
                            {
                                 <option value="@destino.id" >@destino.Codigo - @destino.Nombre</option>
                            }
                        </select>

                    </td>
                </tr>
                <tr>

                    <td>
                        <input type="submit" value="Guardar" /></td>
                    <td>
                        <button>Limpiar</button></td>
                </tr>
            </tbody>
            <tfoot>
            </tfoot>
        </table>

    </form>



    <br />
    <br />

    <p id="parrafoAdvertencia">&nbsp;</p>

    <br />
    <br />

    <h3>Micros asociados</h3>

    <table id="tablaMicrosExistentes">
        <thead>
            <tr>
                <td>Codigo interno</td>
                <td>Destino</td>
                <td></td>
            </tr>
        </thead>

        <tbody>

            <!-- fila base para clonar y agregar al final -->
            <tr class="celdasOcultas">
                <td class="celdaCodigoInterno"></td>
                <td class="celdaDestino"></td>
                <td hidden="hidden">
                    <a class="linkEditar">
                        <img src="~/Content/AdmEmpresasDestinos/images/edit.png" class="iconos" />
                    </a>&nbsp; &nbsp;
                    <a class="linkEliminar">
                        <img src="~/Content/AdmEmpresasDestinos/images/delete.png" class="iconos" />
                    </a>&nbsp; &nbsp;
                    
                </td>
            </tr>


            @foreach (var micro in Model.Micros)
            {
                <tr>
                    <td>@micro.Codigo</td>
                    <td>@micro.destino.Nombre</td>
                    
                    <td>
                        <a href="@Url.Action("Edit", "Micro", new { id = micro.id })" class="linkEditar">
                            <img src="~/Content/AdmEmpresasDestinos/images/edit.png" class="iconos" />
                        </a>&nbsp; &nbsp;
                   
                    <a onclick="eliminarMicro(@micro.id, this)" class="linkEliminar">
                        <img src="~/Content/AdmEmpresasDestinos/images/delete.png" class="iconos" />
                    </a>&nbsp; &nbsp;

                    </td>
                </tr>
            }




        </tbody>
        
        
        <tfoot>
        </tfoot>
    </table>

    <script src="~/Content/AdmEmpresasDestinos/scripts/scriptEmpresaAdminMicros.js"></script>
    <script type="text/javascript">
        var urls = {};
        urls.darAltaMicro = "@Url.Action("DarAtlaMicro", "Micro")";
        urls.editarMicro = "@Url.Action("Edit", "Micro")";
        urls.eliminarMicro = "@Url.Action("EliminarMicro", "Micro")";
    </script>



</body>
</html>
